package c.e.a.b.f.b;

import android.os.Bundle;
import c.e.a.b.e.c.ga;
import java.util.Iterator;
import java.util.Objects;
import java.util.TreeSet;

/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final /* synthetic */ class b6 implements Runnable {
    public final c6 a;
    public final Bundle b;

    public b6(c6 c6Var, Bundle bundle) {
        this.a = c6Var;
        this.b = bundle;
    }

    public final void run() {
        c6 c6Var = this.a;
        Bundle bundle = this.b;
        Objects.requireNonNull(c6Var);
        if (!ga.a() || !c6Var.a.g.o(p.z0)) {
            return;
        }
        if (bundle == null) {
            c6Var.l().C.b(new Bundle());
            return;
        }
        Iterator it;
        int i;
        Bundle a = c6Var.l().C.a();
        for (String str : bundle.keySet()) {
            Object obj = bundle.get(str);
            if (obj != null && !(obj instanceof String) && !(obj instanceof Long) && !(obj instanceof Double)) {
                c6Var.k();
                if (t9.W(obj)) {
                    c6Var.k().R(c6Var.p, 27, null, null, 0);
                }
                c6Var.d().k.c("Invalid default event parameter type. Name, value", str, obj);
            } else if (t9.r0(str)) {
                c6Var.d().k.b("Invalid default event parameter name. Name", str);
            } else if (obj == null) {
                a.remove(str);
            } else if (c6Var.k().b0("param", str, 100, obj)) {
                c6Var.k().I(a, str, obj);
            }
        }
        c6Var.k();
        int t = c6Var.a.g.t();
        if (a.size() > t) {
            it = new TreeSet(a.keySet()).iterator();
            int i2 = 0;
            while (true) {
                i = 1;
                if (!it.hasNext()) {
                    break;
                }
                String str2 = (String) it.next();
                i2++;
                if (i2 > t) {
                    a.remove(str2);
                }
            }
        } else {
            i = 0;
        }
        if (i != 0) {
            c6Var.k().R(c6Var.p, 26, null, null, 0);
            c6Var.d().k.a("Too many default event parameters set. Discarding beyond event parameter limit");
        }
        c6Var.l().C.b(a);
        q7 p = c6Var.p();
        p.g();
        p.t();
        p.z(new a8(p, a, p.I(false)));
    }
}
